%option noyywrap

%{
#include <sstream>
#include "y.tab.h"
int	lineno = 1;
void yyerror(char *s);
%}

%%
	/* Literal keyword tokens */

about		{ return ABOUT; }
account		{ return ACCOUNT; }
add			{ return ADD; }
afk			{ return AFK; }
agency		{ return AGENCY; }
area		{ return AREA; }
arrange		{ return ARRANGE; }
ask			{ return ASK; }
assignments	{ return ASSIGNMENTS; }
attack		{ return ATTACK; }
autoloot	{ return AUTOLOOT; }
awards		{ return AWARDS; }
background	{ return BACKGROUND; }
ban			{ return BAN; }
bounty		{ return BOUNTY; }
bug			{ return BUG; }
buy			{ return BUY; }
call_control { return CALLCONTROL; }
cast		{ return CAST; }
channel		{ return CHANNEL; }
character	{ return CHARACTER; }
check		{ return CHECK; }
chown		{ return CHOWN; }
client		{ return CLIENT; }
climb		{ return CLIMB; }
clone		{ return CLONE; }
close		{ return CLOSE; }
commands	{ return COMMANDS; }
consider	{ return CONSIDER; }
contents	{ return CONTENTS; }
cooldowns	{ return COOLDOWNS; }
coordinates { return COORDINATES; }
cover		{ return COVER; }
create		{ return CREATE; }
crouch		{ return CROUCH; }
d			{ return DOWN; }
db			{ return DB; }
delete		{ return DELETE; }
describe	{ return DESCRIBE; }
destroy 	{ return DESTROY; }
disband		{ return DISBAND; }
disconnect	{ return DISCONNECT; }
doing		{ return DOING; }
door		{ return DOOR; }
dossier		{ return DOSSIER; }
down		{ return DOWN; }
draw		{ return DRAW; }
drop		{ return DROP; }
duel		{ return DUEL; }
dump		{ return DUMP; }
e			{ return EAST; }
edit		{ return EDIT; }
east		{ return EAST; }
effects		{ return EFFECTS; }
emotes		{ return EMOTES; }
emoteto		{ return EMOTETO; }
enter		{ return ENTER; }
entrances	{ return ENTRANCES; }
equip		{ return EQUIP; }
examine		{ return EXAMINE; }
exits		{ return EXITS; }
faq			{ return FAQ; }
feat		{ return FEAT; }
find		{ return FIND; }
finger		{ return FINGER; }
friends		{ return FRIENDS; }
follow		{ return FOLLOW; }
get			{ return GET; }
give		{ return GIVE; }
giveitem	{ return GIVEITEM; }
go			{ return GO; }
grab		{ return GRAB; }
help		{ return HELP; }
history		{ return HISTORY; }
hold		{ return HOLD; }
holster		{ return HOLSTER; }
idea		{ return IDEA; }
ignore		{ return IGNORE; }
inventory	{ return INVENTORY; }
invite		{ return INVITE; }
jargon		{ return JARGON; }
join		{ return JOIN; }
jump		{ return JUMP; }
kill		{ return KILL; }
last		{ return LAST; }
leave		{ return LEAVE; }
list		{ return LIST; }
listen		{ return LISTEN; }
load		{ return LOAD; }
locate		{ return LOCATE; }
lock		{ return LOCK; }
log			{ return LOG; }
look		{ return LOOK; }
mail		{ return MAIL; }
man			{ return MAN; }
me			{ return ME; }
memory		{ return MEMORY; }
message		{ return MESSAGE; }
module		{ return MODULE; }
motd		{ return MOTD; }
move		{ return MOVE; }
mutant		{ return MUTANT; }
n			{ return NORTH; }
news		{ return NEWS; }
north		{ return NORTH; }
note		{ return NOTE; }
npc			{ return NPC; }
object		{ return OBJECT; }
occupation	{ return OCCUPATION; }
open		{ return OPEN; }
owner		{ return OWNER; }
passwd		{ return PASSWD; }
pick		{ return PICK; }
profession	{ return PROFESSION; }
push		{ return PUSH; }
put			{ return PUT; }
queues		{ return QUEUES; }
quit		{ return QUIT; }
recite		{ return RECITE; }
recruit		{ return RECRUIT; }
read		{ return READ; }
reboot		{ return REBOOT; }
reghelper	{ return REGHELPER; }
reload		{ return RELOAD; }
remove		{ return REMOVE; }
repair		{ return REPAIR; }
reset		{ return RESET; }
rest		{ return REST; }
room		{ return ROOM; }
run			{ return RUN; }
s			{ return SOUTH; }
save		{ return SAVE; }
say			{ return SAY; }
search		{ return SEARCH; }
seen		{ return SEEN; }
sell		{ return SELL; }
send		{ return SEND; }
set			{ return SET; }
shout		{ return SHOUT; }
shutdown	{ return SHUTDOWN; }
skill		{ return SKILL; }
shop		{ return SHOP; }
show		{ return SHOW; }
sit			{ return SIT; }
socials		{ return SOCIALS; }
spells		{ return SPELLS; }
stand		{ return STAND; }
stats		{ return STATS; }
south		{ return SOUTH; }
tables		{ return TABLES; }
take		{ return TAKE; }
target		{ return TARGET; }
tasks		{ return TASKS; }
team		{ return TEAM; }
teleport	{ return TELEPORT; }
tell		{ return TELL; }
throw		{ return THROW; }
title		{ return TITLE; }
train		{ return TRAIN; }
trait		{ return TRAIT; }
turn		{ return TURN; }
u			{ return UP; }
unequip		{ return UNEQUIP; }
unload		{ return UNLOAD; }
unlock		{ return UNLOCK; }
unwield		{ return UNWIELD; }
up			{ return UP; }
uptime		{ return UPTIME; }
users		{ return USERS; }
value		{ return VALUE; }
version		{ return VERSION; }
w			{ return WEST; }
wait		{ return WAIT; }
wall		{ return WALL; }
wallop		{ return WALLOP; }
weapon		{ return WEAPON; }
wear		{ return WEAR; }
west		{ return WEST; }
who			{ return WHO; }
whois		{ return WHOIS; }
wield		{ return WIELD; }

	/* object type keywords */
herb		{ return HERB; }
poltice		{ return POLTICE; }
kit			{ return KIT; }
ammo		{ return AMMO; }
trash		{ return TRASH; }
scratch		{ return SCRATCH; }
armor		{ return ARMOR; }

	/* weapon type keywords */
improvised	{ return IMPROVISED; }
axe			{ return AXE; }
mace		{ return MACE; }
sword		{ return SWORD; }
spear		{ return SPEAR; }
nunchuk		{ return NUNCHUK; }
knife		{ return KNIFE; }
knuckles	{ return KNUCKLES; }
club		{ return CLUB; }
exotic_melee { return EXOTIC_MELEE; }
handgun		{ return HANDGUN; }
assault_rifle { return ASSAULT_RIFLE; }
bolt_rifle 	{ return BOLT_RIFLE; }
sniper_rifle { return SNIPER_RIFLE; }
shotgun		{ return SHOTGUN; }
submachinegun { return SUBMACHINEGUN; }
machinegun 	{ return MACHINEGUN; }
explosive	{ return EXPLOSIVE; }
hurled		{ return HURLED; }
exotic_ranged { return EXOTIC_RANGED; }

	/* determiners */
a			{ return A; }
an			{ return AN; }
the			{ return THE; }

	/* prepositions and phrases */
on			{ return ON; }
of			{ return OF; }
above		{ return ABOVE; }
below		{ return BELOW; }
under		{ return UNDER; }
in			{ return IN; }
to			{ return TO; }
across		{ return ACROSS; }
against		{ return AGAINST; }
at			{ return AT; }
before		{ return BEFORE; }
behind		{ return BEHIND; }
beneath		{ return BENEATH; }
beside		{ return BESIDE; }
between		{ return BETWEEN; }
by			{ return BY; }
for			{ return FOR; }
from		{ return FROM; }
into		{ return INTO; }
upon		{ return UPON; }
inside		{ return INSIDE; }

	/* quantities */
all			{ return ALL; }
some		{ return SOME; }
few			{ return FEW; }
none		{ return NONE; }

	/* conjunction */
and			{ return AND; }
but			{ return BUT; }

[-+*/:(),.;]			{ return yytext[0]; }

[A-Za-z][A-Za-z0-9_]*	{ return IDENTIFIER; }

[0-9]+					{ return INTNUM; }
"0x"[0-9]+[a-fA-F]		{ return HEXNUM; }

'[^'\n]*'	{ int c = input(); unput(c); if (c!='\'') return STRING; else yymore(); }
'[^'\n]$	{ yyerror("Unterminated string"); }

\n			lineno++;

[ \t\r]+	;

"--".*		;	/* comment */

.			yyerror("invalid character");
%%

void yyerror(char * s)
{
	printf("%d: %s at %s\n",lineno, s, yytext);
}


